package pt.iscte.pcd.accounts;

import java.util.Random;

public class Depositer extends Thread {

	private static final int MAX_DEP = 10;
	private static final long SLEEPTIME = 10;
	private int total;
	private Account c;

	public Depositer(Account c) {
		this.c = c;
	}

	public int totalAmountDeposited() {
		return total;
	}

	public void run() {
		Random r = new Random();
		while (!interrupted()) {
			int a = r.nextInt(MAX_DEP);
			c.deposit(a);
			System.out.println("Deposit " + a);
			total += a;
		}
		System.out.println("Depositer done");
	}

}
